package org.atlantis.ymer.command;

import org.atlantis.ymer.DataForwarder;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.node.ObjectNode;

public class ConnectCommand extends JsonCommand {

	private DataForwarder forwarder;
	private String id;

	public ConnectCommand() {
	}

	public ConnectCommand(DataForwarder forwarder) {
		this.forwarder = forwarder;
	}

	public ConnectCommand(String id) {
		this.id = id;
	}

	public DataForwarder getForwarder() {
		return forwarder;
	}

	@Override
	public CommandType getType() {
		return CommandType.CONNECT;
	}

	@Override
	protected JsonNode toJson() {
		ObjectNode node = mapper.createObjectNode();
		node.put("type", CommandType.CONNECT.getValue());
		node.put("data", id);
		return node;
	}
}
